define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {

    var Controller = {
        index: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'roomcardcode/admindiamond/index',
                    table: 'y_agencyrechargelog',
                }
            });

            var table = $("#table");

          table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'ID',
                sortName: 'ID',
                search: false,
                columns: [
                    [
                        {field: 'TransferTime', title:'转账时间',sortable:true, operate: 'BETWEEN', type: 'datetime', addclass: 'datetimepicker', data: 'data-date-format="YYYY-MM-DD HH:mm:ss"', style: 'min-width:90px;'},
                        {field: 'AgencyName', title: '管理员账号',searchable:false},
                        {field: 'SenderID', title: __('游戏ID'),sortable:true},
                        {field: 'SenderNickName', title: __('游戏昵称'),searchable:false},
                        {field: 'TransferDiamond', title: __('房卡转账数量'),searchable:false},
                        {field: 'SenderAFDiamond', title: __('转账房卡余额'),searchable:false},
                        {field: 'ReceiverLevel', title: __('账号类型'),searchable:false},
                        {field: 'ReceiverID', title: __('游戏ID'),searchable:false},
                        {field: 'ReceiverNickName', title: __('游戏昵称'),searchable:false},
                        {field: 'ReceiverAFDiamond', title: __('账户余额'),searchable:false},
                        {field: 'ReceiverType', title: __('交易类型'), searchList: {'0':'扣除','1':'赠送', '2': '库存补充'}},
                    ]
                ],
                
            });

            // 为表格绑定事件
            Table.api.bindevent(table);
        },
        add: function () {
            Controller.api.bindevent();
        },
        edit: function () {
            Controller.api.bindevent();
        },
        api: {
            bindevent: function () {
                Form.api.bindevent($("form[role=form]"));
            }
        }
    };
    return Controller;
});